package io.renren.modules.welderradio.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import io.renren.modules.weldradio.entity.WeldradioEntity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import io.renren.modules.welderradio.entity.WelderradioEntity;
import io.renren.modules.welderradio.service.WelderradioService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2022-12-25 17:20:19
 */
@RestController
@RequestMapping("welderradio/welderradio")
public class WelderradioController {
    @Autowired
    private WelderradioService welderradioService;


    @GetMapping("getwelderradio")
    public List<WelderradioEntity> getwelderradio(@RequestParam(value = "key",required = false) String welderId,@RequestParam(value = "startTime",required = false) String startTime, @RequestParam(value = "endTime",required = false) String endTime){
        return welderradioService.getwelderradio(welderId,startTime,endTime);
    }

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("welderradio:welderradio:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = welderradioService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{welderid}")
    @RequiresPermissions("welderradio:welderradio:info")
    public R info(@PathVariable("welderid") Integer welderid){
		WelderradioEntity welderradio = welderradioService.getById(welderid);

        return R.ok().put("welderradio", welderradio);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("welderradio:welderradio:save")
    public R save(@RequestBody WelderradioEntity welderradio){
		welderradioService.save(welderradio);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("welderradio:welderradio:update")
    public R update(@RequestBody WelderradioEntity welderradio){
		welderradioService.updateById(welderradio);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("welderradio:welderradio:delete")
    public R delete(@RequestBody Integer[] welderids){
		welderradioService.removeByIds(Arrays.asList(welderids));

        return R.ok();
    }

}
